package com.example.wificovv2;


import com.example.wificov.Loadpicture;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity implements Guide.OnItemSelectedListener{

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);				
		
		Button  idsampling1= (Button)findViewById(R.id.maintask1);
		Button  idsampling2= (Button)findViewById(R.id.maintask2);
		Button  exitapp= (Button)findViewById(R.id.exitapp);
		
		idsampling1.setOnClickListener(new View.OnClickListener() {
		
			@Override
			public void onClick(View v) {
			// chuyen den Activity Loadmap de lay thuc dia
			Intent intent = new Intent(MainActivity.this, Loadmap.class);
			startActivity(intent);}});
	
		idsampling2.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
			// Chuyen den Activity Loadpicture de lay so do thuc dia la file anh
			Intent intent = new Intent(MainActivity.this,Loadpicture.class);
			startActivity(intent);}});
		
		exitapp.setOnClickListener(new View.OnClickListener() {
		
			@Override
			public void onClick(View v) {
            
			System.exit(0);}});}
	
		
	@Override
	public void versionifor (String link){
		AppInformation fragment = (AppInformation) getFragmentManager().findFragmentById(R.id.mapFragment);
		if (fragment != null && fragment.isInLayout()) {
			fragment.setText(link);
		}
	}
  
	@Override
	public void guideinfo (String link){
		AppInformation fragment = (AppInformation) getFragmentManager().findFragmentById(R.id.mapFragment);
		if (fragment != null && fragment.isInLayout()) {
			fragment.setInfo(link);
		}
		
	}
	

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		super.onCreateOptionsMenu(menu);
		menu.add("Go back home screen")
		.setIntent(new Intent(this, MainActivity.class));		
		menu.add("Wst")
		.setIntent(new Intent(this, WSTActivity.class));
//		menu.add("Sampling power")
//		.setIntent(new Intent(this, SamplingPowPic.class));
		menu.add("Sampling pos and bandwidth")
		.setIntent(new Intent(this, SeekAp.class));
		menu.add("View pow map")
		.setIntent(new Intent(this, Displaypow.class));
		menu.add("View band map")
		.setIntent(new Intent(this, Displayband.class));
		menu.add("View wlan map")
		.setIntent(new Intent(this, Wlanmap.class));
		return true;
	}

	@Override
    public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId())
    	{
       case R.id.mainscreen:
        //Xử lý tro ve man hinh chinh
    	   break;
        case R.id.guide:
        //xử lý xem thông huong dan
        	break;
        case R.id.wst:
        	break;
        case R.id.samplingpow:
        	break;
        case R.id.samplingband:
        	break;
        case R.id.powermap:
        	break;	
        case R.id.bandwidthmap:
        	break;	
        case R.id.wlanmap:
        	break;	
        }
        return super.onOptionsItemSelected(item);
        }

}
